package com.huawei.od;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * 最小循环子数组
 * 1 2 1 1 2 1 1 2 1
 * = 1 2 1
 */
public class T6 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        //输入数字 表示 数组中一共有多少个数
        int count = scanner.nextInt();

        Scanner scanner2 = new Scanner(System.in);
        String s = scanner2.nextLine();
        String[] arr = s.split(" ");

        System.out.println(method0(count, arr));
    }

    private static int method0(int num, String[] arr) {
        List<Integer> list = getYZ(num);
        int min = num;

        for (Integer i : list) {
            if (meet(arr, i)
                    && i < min) {
                min = i;
            }
        }
        return min;
    }

    /**
     * 判断前 i 个是子序列
     *
     * @param arr
     * @param i
     * @return
     */
    private static boolean meet(String[] arr, Integer i) {
        StringBuilder single = new StringBuilder();

        for (int k = 0; k < i; k++) {
            single.append(arr[k]).append(" ");
        }
        int t = arr.length / i;

        for (int m = 1; m < t; m++) {
            StringBuilder each = new StringBuilder();
            for (int n = 0; n < i; n++) {
                each.append(arr[m * i + n]).append(" ");
            }
            if (!single.toString().equals(each.toString())) {
                return false;
            }
        }
        return true;
    }

    private static List<Integer> getYZ(int num) {
        List<Integer> list = new ArrayList<>();
        for (int i = 1; i <= num; i++) {
            if (num % i == 0) {
                list.add(i);
            }
        }
        return list;
    }
}
